﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Data.Linq;
using System.Text;

namespace QL_Nha_Sach_Phuong_Nam
{
    class Cxulytheloai
    {
        private CDuLieu data;

        public Cxulytheloai()
        {
            data = CDuLieu.khoitao();
        }

        #region các hàm xử lý

        //get ds the loai
        public List<TheLoai> getdsTheLoai()
        {
            return data.getdsTheLoai();
        }

        //tim theo ma
        public TheLoai TimTheloaitheoma(string matl)
        {
            TheLoai tl = new TheLoai();
            foreach (TheLoai theloai in getdsTheLoai())
            {
                if (theloai.TheLoaiNo == matl)
                    tl = theloai;
            }
            return tl;
        }

        //tim theo ten
        public TheLoai TimTheloaitheoten(string tent1)
        {
            TheLoai tl = new TheLoai();
            foreach (TheLoai theloai in getdsTheLoai())
            {
                if (theloai.TheLoaiName == tent1)
                    tl = theloai;
            }
            return tl;
        }

        //Them the loai
        public void ThemTheloai(TheLoai tl)
        {
            data.ThemTheLoai(tl);
        }

        //Xoa the loai
        public void XoaTheloai(string ten)
        {
            data.XoaTheLoai(ten);
        }

        //Sua the loai
        public void SuaTheloai(TheLoai tl)
        {
            data.SuaTheLoai(tl);
        }
        #endregion


    }
}
